package top.kaoshanji.p1ch02b;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 代码清单-p1ch02b-44页a：创建配置类
 * @author kaoshanji
 * ^_^
 * create time 2025/4/22 15:14
 */
@Configuration
public class CDPlayerConfig {

    /**
     * 代码清单-p1ch02b-45页a：声明简单的bean
     * @return CompactDisc
     */
    @Bean
    public CompactDisc sgtPeppers() {
        return new SgtPeppers();
    }

    /**
     * 代码清单-p1ch02b-46页a：借助JavaConfig实现注入
     * @return CDPlayer
     */
    @Bean
    public CDPlayer cdPlayer() {
        return new CDPlayer(sgtPeppers());
    }


}
